# --*-- coding:utf8 --*--
import os
from pyecharts.charts import Sunburst
from pyecharts import options as opts
from tools.path import cur_path

CURPATH = cur_path()


def sun(data, name):
    sunburst = (
        Sunburst(init_opts=opts.InitOpts(width="1340px", height="555px"))
            .add(series_name="", data_pair=data, radius=[0, "100%"])
            .set_global_opts(title_opts=opts.TitleOpts(title=name),)
            .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}"),)
            .render(os.path.join(CURPATH, "旭日图-%s.html" % name))
    )
